<template>
  <div>
    <div>
      <a :href="urlTo" class="goods_item">
        <!-- 图片 -->
        <div class="goods_pic">
          <img :src="goods_pic" alt="" />
        </div>
        <!-- 内容 -->
        <div class="goods_cont">
          <div class="goods_title">
            {{ goods_title }}
          </div>
          <div class="goods-price dislay-flex">
            <div class="price">
              <span class="left">￥</span
              ><span class="right">{{ goods_price }}</span>
            </div>
            <div class="tab">{{ goods_tab }}</div>
          </div>
        </div>
        <!-- 发布员 -->
        <div class="goods-user dislay-flex">
          <div class="goods-user_left">
            <img class="user" :src="user_pic" /><span class="num">{{
              user_name
            }}</span>
          </div>
          <div class="goods-user_right">
            <span>{{ goods_time }}</span>
          </div>
        </div>
      </a>
    </div>
  </div>
</template>

<script>
export default {
  name: "ToutiaoGoodsitem",

  components: {},

  directives: {},

  data() {
    return {
      urlTo: "javascript:;",
      goods_pic: "./学习中心.png",
      goods_title: "大一到大三全部教材：计算机科学与技术专业dsfdsfsafdasf",
      goods_price: "4.00",
      goods_tab: "全新",
      user_pic: "../my/img/touxiang.png",
      user_name: "管理员",
      goods_time: "06-17",
    };
  },

  mounted() {},

  methods: {},
};
</script>

<style lang="less" scoped>
.goods_item {
  border-radius: 8px;
  width: calc(50% - 15px);
  background: #fff;
  overflow: hidden;
  max-width: 368px;
  float: left;
  position: relative;
  margin: 0 0px 7px 7px;
}
.goods_pic {
  position: relative;
  width: 100%;
  height: calc((100vw - 50px) / 2);
  max-width: 368px;
  max-height: 368px;
  img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}
.goods_cont {
  padding: 0 5px;
}
.goods_title {
  margin: 10px 0;
  font-size: 14px;
  line-height: 18px;
  height: 35px;
  max-height: 35px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  color: #000;
}
.dislay-flex {
  display: -webkit-box;
  display: -moz-box;
  display: -ms-flexbox;
  display: -webkit-flex;
  display: flex;
}
.goods-price .price {
  line-height: 32px;
  color: red;
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  .left {
    font-size: 15px;
  }
  .right {
    font-size: 20px;
  }
}
.tab {
  border: 1px solid #507eff;
  padding: 0px 5px;
  color: #507eff;
  font-size: 14px;
  border-radius: 5px;
  margin-right: 2px;
  height: 27px;
  margin-top: 5px;
  line-height: 27px;
}
.goods-user {
  padding-top: 5px;
  padding-bottom: 3px;
  line-height: 30px;
  color: #9c9c9c;
  font-size: 14px;
}
.goods-user_left {
  width: 65%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 5px;
}
.goods-user_right {
  flex: 1;
  text-align: right;
  padding-right: 4px;
}
img.user {
  width: 25px;
  height: 25px;
  border-radius: 50px;
  vertical-align: -7px;
}
.goods-user_left span {
  padding-left: 5px;
}
</style>